function Switch(){
    var status = $(".all_category").css("width");
    var screenWidth = document.body.clientWidth;
    if (status != "0px") {
        $(".sub_cat_box").fadeOut(200);
        $(".all_category").animate({width:"0px"},500);
        $(".all_category").animate({height:"0px"},500);
        setTimeout(function () {
            $(".sub_cat_box").fadeOut(200);
        },1000)
    }else {
        var targetWidth = screenWidth-150;
        //targetWidth = 360;
        $(".all_category").animate({height:"100px"},100);
        $(".all_category").animate({width:targetWidth},500);
        setTimeout(function () {
            $(".sub_cat_box").fadeIn(200);
        },500);
    }
}
$(".all_category").on("click","#switch",function () {
    Switch();
});
$(".all_category").on("mouseleave",".sub_cat_box",function () {
    Switch();
});
$(".sub_cat").on("mouseover","a",function () {
    var parent = $(this).attr("catId");
    var sons = jsonCourseCategory[parent];
    $(".sub_cat0 span").empty();
    $(".sub_cat1").hide();
    $(".sub_cat0").show();
    for (k in sons) {
        var html = '<a href="'+exploreUrl + '?cat=' + sons[k].id +'" catId="'+ sons[ k ].id +'">'+ sons[ k ].name +'</a>';
        $(".sub_cat0 span").append(html);
    }
});
$(".sub_cat0 ").on("mouseover","a",function () {
    var parent = $(this).attr("catId");
    var sons = jsonCourseCategory[parent];
    $(".sub_cat1 span").empty();
    var empty;
    for (k in sons) {
        empty = 1;
        var html = '<a  href="'+exploreUrl + '?cat=' + sons[k].id +'" catId="'+sons[k].id+'">'+sons[k].name+'</a>';
        $(".sub_cat1 span").append(html);
    }
    if (empty == 1) {
        $(".sub_cat1").show();
    }else{
        $(".sub_cat1").hide();
    }
});